<template>
  <div class="c-bg-sgray">
    <div class="c-bg-white c-pf c-w100 c-pz100 c-maxw640">
      <new-search-bar @search="startSearch" bgSearch="c-bg-white c-pt24-i" @clear="clear" @cancel="cancel" :searchText="searchName" ref="searchBar"></new-search-bar>
      <my-small-tabbar id="tabhBar" :fontSet="{defaultColor:'c-fc-sblack',activeColor:'c-fw500'}" :isNew="true" :styleType="2" :isLeft="true" :tabList="tabList" :tabIndex="type" @changeTab="changeType"></my-small-tabbar>
    </div>

    <div class="c-pt168 c-ph24" v-show="type == 0">
      <div class="c-pv24 c-ph24 c-br20 c-bg-white c-mt24 c-p" v-for="(item,index) in answerList" :key="index">
        <div class="c-flex-row c-justify-sb c-aligni-start">
          <div class="c-ww80 c-hh80 c-brp50 c-text-hidden c-flex-shrink0 c-mt4 c-p" @click="clickGoAswerCir(item.answerId)">
            <CoverImg :coverSizeClass="'c-w100 c-h c-text-hidden'" :coverUrl="$addXossFilter(item.avatar, require('../../../assets/defult_head.png'))" />
          </div>
          <div class="c-w0 c-flex-grow1 c-pl20">
            <div >
              <div class="c-flex-row c-justify-sb">
                <div class="c-text-ellipsis1 c-fw400 c-ws-n c-flex-row c-aligni-center" @click="clickGoAswerCir(item.answerId)">
                  <span class="c-fs28 c-fc-xblack c-text-ellipsis1 c-lh28 c-fw-b">{{item.name}}</span>
                </div>
                <div class="c-flex-row c-aligni-center c-fc-gray c-fs18">
                  {{item.allCount}}条回答
                </div>
              </div>
              <div @click="clickGoAswerCir(item.answerId)">
                <span class="c-maxw160 c-inlineblack c-lh28 c-fs18 c-pv2 c-ph10 theme-bg-10 theme-fc c-br4 c-mt12 c-text-ellipsis1">{{item.honor}}</span>
              </div>
            </div>
            <div class="c-flex-row c-justify-sb c-aligni-center">
              <div class="c-flex-row c-aligni-center c-fs20">
                <div class="c-fs22 c-mt10 c-fw600 c-fc-xmlred">
                  <span v-if="item.price > 0 && item.freeCount == 0 && !$isWxAppIos()" class="c-fs20">{{'￥' | iosPriceFilter('Question')}}</span>
                  <span :class="item.price == 0 || (item.isMe == -1 && item.freeCount > 0) ? 'c-fs22' : 'c-fs36'" v-html="$getPriceStyleHtml(Number(pirceNum(item)).toFixed(2), true, 15, 'c-fs22')"></span>
                </div>
                <div v-if="isShowVipPrice(item)" class="c-ph10 c-pv6 c-bg-xmlred-10 c-br8 c-ml12 c-mt10">
                  <span class="c-fs18 c-fc-xmlred">VIP<span v-if="(item.vipDiscountType == 1 && item.vipDiscount > 0) || (item.vipDiscountType == 2 && Number(item.vipDiscountPrice) > 0)" class="c-fs18 c-fc-xmlred">{{'￥' | iosPriceFilter('Question')}}</span>{{(item.vipDiscountType == 1 && item.vipDiscount == 0) || (item.vipDiscountType == 2 && Number(item.vipDiscountPrice) == 0) ? '免费' : item.vipDiscountType == 2 ? Number(item.vipDiscountPrice).toFixed(2) : Number(item.vipDiscount * item.price / 100).toFixed(2)}}</span>
                </div>
                <div v-if="isShowSvipPrice(item)" class="c-ph10  c-pv6 c-bg-xmlred-10 c-br8 c-ml12 c-mt10">
                  <span class="c-fs18 c-fc-xmlred">SVIP<span v-if="(item.vipDiscountType == 1 && item.svipDiscount > 0) || (item.vipDiscountType == 2 && Number(item.svipDiscountPrice) > 0)" class="c-fs18 c-fc-xmlred">{{'￥' | iosPriceFilter('Question')}}</span>{{(item.vipDiscountType == 1 && item.svipDiscount == 0) || (item.vipDiscountType == 2 && Number(item.svipDiscountPrice) == 0) ? '免费' : item.vipDiscountType == 2 ? Number(item.svipDiscountPrice).toFixed(2) : Number(item.svipDiscount * item.price / 100).toFixed(2)}}</span>
                </div>
                <!-- <div class="c-fc-gray c-fs22"><span class="c-ph10" v-if="(((item.isMe == -1 && (item.price == 0 || item.freeCount > 0)) || (item.price == 0)) && $isWxAppIos()) || (!$isWxAppIos())">/</span>{{item.allCount}}条回答</div> -->
              </div>
            </div>
            <div class="c-w100  c-flex-row c-justify-end" :class="isShowVipPrice(item) && isShowSvipPrice(item)?'c-mt24':''">
              <div @click="clickMyAsw" v-if="item.isMe == 1" class="c-flex-row c-flex-center c-ww128 c-hh48 c-fs22 c-br32 c-fc-sxblack theme-bd1 theme-fc ">我的{{questionCustom == 1 ? '预约' : '回答'}}</div>
              <div @click="clickAskQue(item.answerId, true)" v-else-if="item.isMe == -1 && (item.price == 0 || item.freeCount > 0)" class="c-flex-row c-flex-center c-ww128 c-hh48 c-fs22 c-fc-white theme-bg c-br32" :class="isShowVipPrice(item) && isShowSvipPrice(item) ?'':'c-pa c-p-t100 c-p-r24'">
                {{questionCustom == 1 ? '预约' : '提问'}}
              </div>
              <div @click="clickAskQue(item.answerId, false)" v-else class="c-flex-row c-flex-center c-ww128 c-hh48 c-fs22 c-fc-white theme-bg c-br32" :class="isShowVipPrice(item) && isShowSvipPrice(item) ?'':'c-pa c-p-t100 c-p-r24'">
                {{questionCustom == 1 ? '预约' : '提问'}}
              </div>
            </div>
          </div>
        </div>
      </div>
      <loading-status-tem :dataStatus="aswStatus" :noDataText="'暂无相关记录'"></loading-status-tem>
    </div>
    <div class="c-pt158" v-show="type == 1">
      <div class="c-bg-sgray">
        <qa-list :list="questionList" :bindPhoneSetting="bindPhoneSetting" :isDirect="1" :fromType="4" class="c-ph24" :playAduioSrc="playAduioSrc" @clickPreviewImage="clickPreviewImage" @clickPlayAudio="clickPlayAudio" @clickShowVideo="clickShowVideo"></qa-list>
      </div>
      <loading-status-tem :dataStatus="queStauts" :noDataText="'暂无相关记录'"></loading-status-tem>
    </div>
    <video-popup :showVideo="showVideo" @clickCloseVideo="clickCloseVideo" :videoSrc="currentVideoObj.videoSrc" :m3u8Url="currentVideoObj.m3u8Url"></video-popup>
    <audio id="audio" @ended="playAudioEnd" class="c-pf c-p-l-100"></audio>
    <div v-if="companyAuth != null && companyAuth.companyNav != null">
      <nav-bottom-bar :itemIndex="11" v-for="(item,index) in companyAuth.companyNav" :key="index" v-if="item.navType == 12"></nav-bottom-bar>
    </div>
  </div>
</template>

<script>
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import NavBottomBar from "@/components/templates/common/navBottomBar.vue";
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import newSearchBar from "@/components/templates/common/newSearchBar.vue";
import { utilJs, wxUtilJs } from "@/utils/common.js";
import QaList from "@/components/templates/qa/qaList.vue";
import videoPopup from "@/components/templates/common/videoPopup.vue";
import CoverImg from '@/components/templates/common/coverImg.vue';
import { getBindPhoneSetting } from "@/utils/checkUnBindPhone.js";
let PAGE_SIZE = 10;
let aswPageIndex = 1;
let quePageIndex = 1;
let isLoading = false;
let currentLocalId = ""; //当前录制本地音频ID
let curPlayLocalId = ""; //当前播放本地音频ID
export default {
  name: "AnswerLord",
  components: {
    loadingStatusTem,
    NavBottomBar,
    MySmallTabbar,
    QaList,
    newSearchBar,
    videoPopup,
    CoverImg
  },
  props: [],
  data() {
    return {
      theme: localStorage.getItem("colorName")
        ? localStorage.getItem("colorName")
        : "mb5_default",
      themeName: localStorage.getItem('themeName') ? localStorage.getItem('themeName') : 'mb5',
      questionCustom: localStorage.getItem("questionCustom"), //定制阿卡西线上学院
      type: 0,
      isShowNum: 0,
      queStauts: 'HAS_MORE_DATA',
      aswStatus: 'HAS_MORE_DATA',
      answerList: [],
      questionList: [],
      companyAuth: localStorage.getItem("companyAuth") ? JSON.parse(localStorage.getItem("companyAuth")) : null,
      tabList: [{
        title: '',
        index: 0,
      }, {
        title: '',
        index: 1,
      }],
      isPlayTest: false, //是否试听
      playAduioSrc: "", //播放音频地址
      isReply: 0,
      showVideo: false,
      isAnswerLord: 0, // 是否是答主
      isQuestioner: 0, // 是否是提问者
      isPlayingAudio: false,
      searchName: '',
      isSearch: false,
      currentVideoObj: {},
      circleId: "",
      circleMemberId: "",
      bindPhoneSetting: null
    };
  },
  beforeRouteEnter(to, from, next) {
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不！能！获取组件实例 `this`
    // 因为当守卫执行前，组件实例还没被创建
    next(vm => {
      if (from.path != "/homePage/login/bindMobile") {
        // 不是从绑定手机号页面来
        // if (localStorage.getItem('enableBindPhoneEnterBeforeInQuestion') == 1 && localStorage.getItem('uMobile') == '') {
        //   vm.$routerGo(vm, "push", {
        //     path: '/homePage/login/bindMobile'
        //   })
        // }
      } else {
        // 从绑定手机页面来,手机号为空 即返回
        // if (localStorage.getItem('enableBindPhoneEnterBeforeInQuestion') == 1 && localStorage.getItem('uMobile') == '') {
        //   vm.$routerGo(vm, "push", { path: "/" });
        // } else {
          // 从绑定手机页面来,手机号存在 即绑定成功 跳问答专区
          vm.$routerGo(vm, "push", {
            path: '/homePage/qa/answerLord'
          })
        // }
      }
      // 通过 `vm` 访问组件实例
      if (from.path == "/homePage/course/coursePay" || from.path == "/homePage/qa/answerDetail") {
        //tab切换到问题 之后进入支付或者问题详情页 再返回
        vm.isQuestioner = 0;
        vm.isAnswerLord = 1;
      } else if ((from.path != "/homePage/qa/questionDetail") || vm.answerList.length == 0) {
        vm.isAnswerLord = 0;
        vm.isQuestioner = 0;
        vm.type = 0;
      } else if (from.path == "/homePage/qa/questionDetail") {
        //tab切换到答主 之后进入问题详情页 再返回
        vm.isAnswerLord = 0;
        vm.isQuestioner = 1;
      }
      aswPageIndex = 1;
      quePageIndex = 1;
      isLoading = false;
      vm.answerList = [];
      vm.questionList = [];
      vm.type = 0;
      vm.circleId = vm.$route.query.circleId || "";
      vm.getAnswererList(true);
      vm.getQuestionList(true);
      if (!localStorage.getItem("questionInfo")) return
      let questionInfo = JSON.parse(localStorage.getItem("questionInfo"));
      let companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
      if ((questionInfo && questionInfo.status == -1) || (companyAuth && companyAuth.enableQuestionModule == -1)) {
        vm.$routerGo(vm, "replace", {
          path: "/error/emptyPage",
          query: {
            info: "问答已下架"
          }
        });
      }
    });
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() { },
  computed: { },
  methods: {
    pirceNum(item) {
      let price = 0.00
      if (item.isMe == -1 && (item.price == 0 || item.freeCount > 0)) {
        price = 0.00
      } else if (item.price == 0) {
        price = 0.00
      } else if (!this.$isWxAppIos()) {
        price = item.price
      }
      return price
    },
    isShowVipPrice(item) {
      if (item.price > 0 && item.freeCount == 0 && !this.$isWxAppIos() && ((item.vipDiscountType == 1 && item.vipDiscount < 100) || (item.vipDiscountType == 2 && Number(item.vipDiscountPrice) < Number(item.price)))) {
        return true;
      } else {
        return false;
      }
    },
    isShowSvipPrice(item) {
      if (item.price > 0 && item.freeCount == 0 && !this.$isWxAppIos() && ((item.vipDiscountType == 1 && item.svipDiscount < 100) || (item.vipDiscountType == 2 && Number(item.svipDiscountPrice) < Number(item.price)))) {
        return true;
      } else {
        return false;
      }
    },
    iosAppRouteChange(toPath) {
      if (utilJs.isIOSApp()) {
        window.webkit.messageHandlers.iosWechatRoute.postMessage(toPath);
      } else if (utilJs.isAndoridNewApp()) {
        let data = {
          path: toPath
        }
        window.androidWechatRoute.doAction(JSON.stringify(data))
      } else {
        this.$routerGo(this, "push", { path: toPath });
      }
    },
    changeType(type) {
      window.scroll(0, 0);
      this.type = type;
      this.clearSearchValue();
      if (this.isSearch) {
        if (this.type == 0) {
          quePageIndex = 1;
          this.isAnswerLord = 0;
          this.questionList = [];
          this.getQuestionList();
        } else {
          aswPageIndex = 1;
          this.isAnswerLord = 1;
          this.answerList = [];
          this.getAnswererList();
        }
      } else {
        if (this.type == 0) {
          aswPageIndex = 1;
          this.isAnswerLord = 0;
        } else {
          quePageIndex = 1;
          this.isAnswerLord = 1;
        }
      }
    },
    //点击图片放大预览
    clickPreviewImage(imgUrl, itemImgList) {
      if (!imgUrl) {
        return;
      }

      wxUtilJs.previewImage({
        current: imgUrl, // 当前显示图片的http链接
        urls: itemImgList // 需要预览的图片http链接列表
      });
    },
    //点击我的回答
    clickMyAsw() {
      let toPath = `/homePage/qa/myQA?isAswer=1`;
      this.iosAppRouteChange(toPath);
    },
    //点击进入答主回答的问题列表
    clickGoAswerCir(answerId) {
      let toPath = `/homePage/qa/aswerCircuseeList?answerId=${answerId}`;
      this.iosAppRouteChange(toPath);
    },
    //点击提问
    clickAskQue(answerId, isFree) {
      if ((this.bindPhoneSetting && this.bindPhoneSetting.buyBind && !isFree) ||
      (this.bindPhoneSetting && this.bindPhoneSetting.getBind && isFree)) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.$isWxAppIos() && !isFree) { // 兼容小程序mp项目，不能删除
        this.$showCjToast({
          text: "ios暂不支持提问",
          type: "warn",
        });
        return
      }
      let toPath = `/homePage/qa/questionDetail?answerId=${answerId}&goAsk=1&src=1&circleId=${this.circleId}&circleMemberId=${this.circleMemberId}`;
      this.iosAppRouteChange(toPath);
    },

    //点击查看答案
    clickQuestionItem(index) {
      if (this.questionList[index].isDirect == -1) {
        this.addToCircusee(this.questionList[index].questionDetailId);
      } else {
        let toPath = `/homePage/qa/answerDetail?questionDetailId=${this.questionList[index].questionDetailId}`;
        this.iosAppRouteChange(toPath);
      }
    },

    //添加围观记录
    addToCircusee(questionDetailId) {
      if (isLoading) {
        return;
      }
      isLoading = true;
      utilJs.getMethod(
        global.apiurl +
        "question/circuseeDetail?questionDetailId=" +
        questionDetailId,
        res => {
          isLoading = false;
          if (res.isFree == 1) {
            let toPath = `/homePage/qa/answerDetail?questionDetailId=${questionDetailId}`;
            this.iosAppRouteChange(toPath);
          } else {
            if (!utilJs.isOpenIosGzhPay('15')) {
              this.$store.commit('updateShowVitualModal', true);
              return;
            }
            let toPath = `/homePage/course/coursePay?cId=-1&ckFrom=${global.ckFrom.circusee}&extId=${res.questionOrderId}`;
            this.iosAppRouteChange(toPath);
          }
        },
        failRes => {
          isLoading = false;
        }
      );
    },

    //获取答主列表
    getAnswererList(isFirst) {
      console.log(this.circleId)
      if (!isFirst) {
        if (isLoading) {
          return;
        }
        isLoading = true;
      }
      if (this.aswStatus == 'LOADING') {
        return;
      }
      this.aswStatus = 'LOADING';
      utilJs.getMethod(
        global.apiurl + "question/getAnswererList?limit=" + PAGE_SIZE + "&page=" + aswPageIndex + "&searchName=" + this.searchName + "&circleId=" + this.circleId, res => {
          this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
          isLoading = false;
          if (aswPageIndex == 1) {
            this.answerList = res.data;
          } else {
            let list = res.data;
            this.answerList = this.answerList.concat(list);
          }
          if (res.to * 1 == res.total * 1) {
            this.aswStatus = aswPageIndex == 1 && res.data.length == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
          } else {
            this.aswStatus = 'HAS_MORE_DATA';
            aswPageIndex++;
          }
          // if (this.answerList.length > 0) {
          //   if (this.isAnswerLord == 1) {
          //     // 身份是答主 tab切换到问题 之后到支付页或者问题详情页 再返回 定位到问题
          //     this.type = 1;
          //   } else if (this.answerList[0].isMe == 1 && this.isSearch == false) {
          //     // 页面初始化后 用户身份就是答主 定位到答主
          //     this.type = 0;
          //   } else if (this.answerList[0].isMe == -1 && this.type == 0) {
          //     // 身份就是提问者&&tab 切换到答主 定位到答主
          //     this.type = 0;
          //   } else if (this.answerList[0].isMe == -1 && this.isQuestioner == 1) {
          //     // 身份是提问者 tab切换到问题 之后到支付页或者问题详情页 再返回
          //     this.type = 0;
          //   } else if (this.isSearch && this.type == 0) {
          //     this.type = 0;
          //   } else {
          //     this.type = 0;
          //   }
          // } else {
            this.type = 0;
          // }
          if (this.isSearch && this.type == 1) {
            this.isSearch = false;
          }
        },
        failRes => {
          isLoading = false;
        }
      );
    },
    //获取问题列表
    getQuestionList(isFirst) {
      if (!isFirst) {
        if (isLoading) {
          return;
        }
        isLoading = true;
      }
      if (this.queStauts == 'LOADING') {
        return;
      }
      this.queStauts = 'LOADING';
      utilJs.getMethod(
        global.apiurl +
        "question/getQuestionDetailList?limit=" +
        PAGE_SIZE +
        "&page=" +
        quePageIndex +
        "&searchName=" +
        this.searchName +
        "&circleId=" +
        this.circleId,
        res => {
          this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
          isLoading = false;

          if (quePageIndex == 1) {
            if (localStorage.getItem("questionInfo") && localStorage.getItem("questionInfo") != "null") {
              this.isShowNum = JSON.parse(localStorage.getItem("questionInfo"))["isShowNum"];
            }
            this.questionList = res.data;
          } else {
            let list = res.data;
            this.questionList = this.questionList.concat(list);
          }
          if (res.to * 1 == res.total * 1) {
            this.queStauts = quePageIndex == 1 && res.data.length == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
          } else {
            this.queStauts = 'HAS_MORE_DATA';
            quePageIndex++;
          }
          if (this.isSearch && this.type == 0) {
            this.isSearch = false;
          }
        },
        failRes => {
          isLoading = false;
        }
      );
    },
    //停止试听
    stopListenAudio() {
      if (this.isPlayTest) {
        wxUtilJs.stopVoice({ localId: currentLocalId });
        this.isPlayTest = false;
      } else {
        wxUtilJs.stopVoice({ localId: curPlayLocalId });
      }
    },
    //监听音频播放结束执行的内容
    playAudioEnd() {
      //播放结束自动播放下一个非自己发的语音并且非已读语音
      this.playAduioSrc = "";
      document.getElementById("audio").src = this.playAduioSrc;
      this.isPlayingAudio = false;
    },
    //点击播放音频
    clickPlayAudio(audioUrl) {
      let audio = document.getElementById("audio");
      if (this.playAduioSrc == audioUrl) {
        this.playAduioSrc = "";
        document.getElementById("audio").src = this.playAduioSrc;
        this.stopListenAudio();
        return;
      }
      this.playAduioSrc = audioUrl;
      this.isPlayTest = false;

      //返回mp3则用audio播放，否则将使用微信将文件下载然后播放
      if (this.playAduioSrc) {
        document.getElementById("audio").src = this.playAduioSrc;
        audio.play();
      }
      this.isPlayingAudio = true;
    },
    //点击显示视频
    clickShowVideo(isReply, questionStatus, videoSrc, m3u8Url) {
       if (questionStatus == -1) {
        return;
      }
      if (this.isPlayingAudio == true) {
        this.playAudioEnd();
      }
      if (isReply == 1) {
        this.isReply = 1;
      }
      this.showVideo = true;
      this.currentVideoObj = {videoSrc, m3u8Url}
    },
    //点击关闭视频
    clickCloseVideo() {
      if (this.showVideo) {
        this.showVideo = false;
      }
    },
    startSearch(e) {
      this.isSearch = true;
      if (this.type == 0) {
        aswPageIndex = 1;
        this.isAnswerLord = 0;
        this.searchName = e.searchValue;
        this.answerList = [];
        this.getAnswererList(true);
      } else {
        quePageIndex = 1;
        this.isAnswerLord = 1;
        this.searchName = e.searchValue;
        this.questionList = [];
        this.getQuestionList(true);
      }
    },
    clear() {
      window.scroll(0, 0)
      if (this.isSearch) {
        if (this.type == 0) {
          aswPageIndex = 1;
          this.searchName = "";
          this.answerList = [];
          this.getAnswererList(true);
        } else {
          quePageIndex = 1;
          this.searchName = "";
          this.questionList = [];
          this.getQuestionList(true);
        }
      }
    },
    cancel() {
      this.clear();
    },
    clearSearchValue() {
      this.$refs.searchBar.clear();
      this.searchName = "";
    },
    //分享
    wechatShare: function () {
      let questionInfo = window.localStorage.getItem("questionInfo") ? JSON.parse(
        window.localStorage.getItem("questionInfo")
      ) : null;
      let title = questionInfo ? questionInfo.title : '问答';
      let shareImg = questionInfo ? questionInfo.cover : '';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = questionInfo ? questionInfo.describe : '点击查看';
      utilJs.wechatConfig(
        shareUrl,
        title,
        shareImg,
        shareDesc,
        function () { },
        true
      );
    },
    //手机端分享
    appShare() {
      let questionInfo = window.localStorage.getItem("questionInfo") ? JSON.parse(
        window.localStorage.getItem("questionInfo")
      ) : null;
      let title = questionInfo ? questionInfo.title : '问答';
      let shareImg = questionInfo ? questionInfo.cover : '';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = questionInfo ? questionInfo.describe : '点击查看';
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    },
    windowScrollFunction() {
      utilJs.handleLoading(() => {
        if (this.type) {
          if (this.queStauts == 'HAS_MORE_DATA' && this.questionList.length > 0) {
            this.getQuestionList();
          }
        } else {
          if (this.aswStatus == 'HAS_MORE_DATA' && this.answerList.length > 0) {
            this.getAnswererList();
          }
        }
      });
    },
  },
  activated() {
    if (this.questionCustom == 1) {
      setDocumentTitle("预约专区");// eslint-disable-line
      this.tabList[0].title = "光之管道";
      this.tabList[1].title = "互动";
    } else {
      setDocumentTitle("问答专区");// eslint-disable-line
      this.tabList[0].title = "答主";
      this.tabList[1].title = "问题";
    }
    currentLocalId = "";
    curPlayLocalId = "";
    this.queStauts = 'HAS_MORE_DATA';
    this.aswStatus = 'HAS_MORE_DATA';
    this.isReply = 0;
    this.playAduioSrc = "";
    this.searchName = "";
    this.isPlayTest = false;
    this.showVideo = false;
    this.isPlayingAudio = false;
    this.isSearch = false;
    this.type = this.$route.query.type || 1;
    this.circleId = this.$route.query.circleId || "";
    this.circleMemberId = this.$route.query.circleMemberId || "";
    getBindPhoneSetting(global.ckFrom.qa).then(res => {
      this.bindPhoneSetting = res;
    });
    this.wechatShare();
    this.$store.commit("updateLoadingStatus", {
      isLoading: false
    });
    window.addEventListener('scroll', this.windowScrollFunction);
  },
  deactivated() {
    this.type = 1;
    this.searchName = "";
    if (document.getElementById("audio")) {
      document.getElementById("audio").src = '';
    }
    window.removeEventListener('scroll', this.windowScrollFunction);
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.box-shadowGrey {
  box-shadow: 0px 4px 15px 4px rgba(0,0,0,0.05);
}
.bg-lgreen {
  background: #30b656;
}
.fc-dblue {
  color: #436AB0;
}
.bd-t1-f5 {
  border-top:1px solid #F5F7FA;
}
.fc-green {
  color: #30B656;
}
</style>
